package haoyou.csnf.manager.module.pm.dal.mysql.employeeinfo;

import java.util.*;

import haoyou.csnf.manager.framework.common.pojo.PageResult;
import haoyou.csnf.manager.framework.mybatis.core.query.LambdaQueryWrapperX;
import haoyou.csnf.manager.framework.mybatis.core.mapper.BaseMapperX;
import haoyou.csnf.manager.module.pm.dal.dataobject.employeeinfo.EmployeeInfoDO;
import org.apache.ibatis.annotations.Mapper;
import haoyou.csnf.manager.module.pm.controller.admin.employeeinfo.vo.*;

/**
 * 职工信息 Mapper
 *
 * @author 好有经验源码
 */
@Mapper
public interface EmployeeInfoMapper extends BaseMapperX<EmployeeInfoDO> {

    default PageResult<EmployeeInfoDO> selectPage(EmployeeInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeInfoDO>()
                .eqIfPresent(EmployeeInfoDO::getDepId, reqVO.getDepId())
                .eqIfPresent(EmployeeInfoDO::getSeqId, reqVO.getSeqId())
                .eqIfPresent(EmployeeInfoDO::getPosId, reqVO.getPosId())
                .eqIfPresent(EmployeeInfoDO::getEmpType, reqVO.getEmpType())
                .likeIfPresent(EmployeeInfoDO::getEmpName, reqVO.getEmpName())
                .eqIfPresent(EmployeeInfoDO::getEmpNo, reqVO.getEmpNo())
                .eqIfPresent(EmployeeInfoDO::getMobile, reqVO.getMobile())
                .eqIfPresent(EmployeeInfoDO::getGender, reqVO.getGender())
                .eqIfPresent(EmployeeInfoDO::getIdNo, reqVO.getIdNo())
                .betweenIfPresent(EmployeeInfoDO::getCollegeEntryDate, reqVO.getCollegeEntryDate())
                .eqIfPresent(EmployeeInfoDO::getTypeFlag, reqVO.getTypeFlag())
                .eqIfPresent(EmployeeInfoDO::getStatusFlag, reqVO.getStatusFlag())
                .orderByDesc(EmployeeInfoDO::getId));
    }

}